import java.util.LinkedList;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/9/26
 */
public class Text46 {
    public static void main(String[] args) {
        LinkedList<Integer> path = new LinkedList<>();
        path.add(1);
        path.add(2);
        path.add(3);
        for(Integer x: path){
            System.out.println(x);
        }
        path.removeLast();

        for(Integer x: path){
            System.out.println(x);
        }
        path.remove();

        for(Integer x: path){
            System.out.println(x);
        }
    }
}
